package com.jishuo.nontax.web.bill;

import com.jishuo.base.annotation.UserAuthority;
import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.GridResult;
import com.jishuo.base.bean.Pagination;
import com.jishuo.base.bean.vo.UserVO;
import com.jishuo.base.config.AppConfig;
import com.jishuo.base.service.UserService;
import com.jishuo.nontax.bean.vo.WaitaffirmPayInfoVO;
import com.jishuo.nontax.bfc.service.WaitaffirmPayInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * @auther dinggaofei
 * @Date 2023/3/16 11:37
 */
@Slf4j
@Controller
@RequestMapping(value = "/bill/waitaffirmpayinfo")
@UserAuthority(menu = {"bill/waitaffirmpayinfo/index", "sys/basedata/index"})
public class WaitaffirmPayInfoController {

    @Resource
    private WaitaffirmPayInfoService waitaffirmPayInfoService;
    @Resource
    private UserService userService;

    private String prefix = "bill/";

    @RequestMapping(value = {"waitaffirmpayinfo"}, name = "99支出首页")
    public String index() {
        return prefix + "waitaffirmpayinfo";
    }

    @ResponseBody
    @RequestMapping(value = "findWaitaffirmPayInfoPage", name = "99支出列表")
    public GridResult<WaitaffirmPayInfoVO> findWaitaffirmPayInfoPage(WaitaffirmPayInfoVO waitaffirmPayInfoVO, Pagination pagination) {

        return new GridResult<>(waitaffirmPayInfoService.findWaitaffirmPayInfoPage(waitaffirmPayInfoVO, pagination));
    }

    @ResponseBody
    @RequestMapping(value = "saveWaitaffirmPayInfo", name = "修改99支出信息")
    public BaseResult saveWaitaffirmPayinfo(WaitaffirmPayInfoVO waitaffirmPayInfoVO) {
        return waitaffirmPayInfoService.saveWaitaffirmPayInfo(waitaffirmPayInfoVO);
    }

    @ResponseBody
    @RequestMapping(value = "insertaffirmPayInfo", name = "添加99支出信息")
    public BaseResult insertWaitaffirmPayInfo(WaitaffirmPayInfoVO waitaffirmPayInfoVO) {
        return waitaffirmPayInfoService.insertWaitaffirmPayInfo(waitaffirmPayInfoVO);

    }

    @ResponseBody
    @RequestMapping(value = "deleteWaitaffirmPayInfo", name = "删除99支出信息")
    public BaseResult deleteWaitaffirmPayInfo(String waitaffirmpayids) {
        return waitaffirmPayInfoService.deleteWaitaffirmPayInfo(waitaffirmpayids);
    }

    @ResponseBody
    @RequestMapping(value = "sendWaitaffirmPayInfo",name = "发送99支出信息")
    public BaseResult  sendWaitaffirmPayInfo(String billids, String userpwd, String usercode, HttpSession session){
        UserVO user = (UserVO) session.getAttribute(AppConfig.LOGIN_USER_SESSION_KEY);
        BaseResult ret = userService.chkAuthUser(usercode, userpwd, user);
        if (!ret.isSuccess()) return ret;
        return  waitaffirmPayInfoService.senfWaitaffirmPayInfo(billids);
    }
    @ResponseBody
    @RequestMapping(value = "getWaitaffirmPayInfo",name = "获取99支出信息")
    public  BaseResult  getWaitaffirmPayInfo (Long waitaffirmpayid){
     return waitaffirmPayInfoService.getWaitaffirmPayIngo(waitaffirmpayid);
    }

    @ResponseBody
    @RequestMapping(value = "findColum",name ="缴款账户条件")
    public BaseResult findColum(){
        return  waitaffirmPayInfoService.findColum();
    }
}
